package com.zzz.dubbo.service.impl;

import com.zzz.dubbo.service.DemoService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Service;
import org.apache.dubbo.rpc.RpcContext;

@Service
@Slf4j
public class Demo02ServiceImpl implements DemoService {
    @Override
    public String sayHello(String name) {
        log.info("I'm pr-02, Hello " + name + ", request from consumer: " + RpcContext.getContext().getRemoteAddress());
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "I'm pr-02, Hello " + name + ", response from provider: " + RpcContext.getContext().getLocalAddress();
    }
}
